/**
 * @description: 用户参数校验
 * @version: 0.0.1
 * @author: z..
 * @Date: 2023-06-08 14:07:35
 */

import { Rule,RuleType } from '@midwayjs/validate';
import { requiredNumber } from "./common";

export enum KeyType {
  is_admin = 'is_admin',
  user_status = 'user_status',
}

// 部门id校验
export class DeptIdDTO {
  @Rule(requiredNumber)
  deptId: number;
}

// 更新
export class UpdateUserDTO {
  @Rule(requiredNumber)
  id: number;
  @Rule(requiredNumber)
  value: number;
  @Rule(RuleType.string().valid(...Object.values(KeyType)))
  key: string;
}

// 更新工时金额
export class UpdateUserAmountDTO {
  @Rule(requiredNumber)
  id: number;
  @Rule(requiredNumber)
  hoursAmount: number;
}

export class ChangeRoleDTO {
  @Rule(requiredNumber)
  userId: number;
  @Rule(requiredNumber)
  roleId: number;
}


